package com.solidumgame.ninja.ingredient.whole
{
	import Box2D.Collision.Shapes.b2Shape;
	
	import com.pblabs.box2D.Box2DManagerComponent;
	import com.pblabs.box2D.Box2DSpatialComponent;
	import com.pblabs.box2D.PolygonCollisionShape;
	import com.pblabs.engine.PBE;
	import com.pblabs.engine.core.ObjectType;
	import com.solidumgame.ninja.ingredient.types.IngredientType;
	import com.solidumgame.ninja.knife.Knife;
	
	import flash.geom.Point;
	
	public class WholeIngredientSpatialComponent extends Box2DSpatialComponent
	{
		public function WholeIngredientSpatialComponent(type:IngredientType)
		{
			super();
			
			this.spatialManager = PBE.lookupEntity("SpatialManager").lookupComponentByName("Manager") as Box2DManagerComponent;
			this.position = new Point(0, 0);
			
			
			this.size = type.getSize();
			
			this.collisionType = new ObjectType(WholeIngredient.TYPE);
			
			this.collisionShapes = type.getShape();
			
			this.collidesWithTypes = new ObjectType(Knife.TYPE);
			
		}
		
		/**
		 * Cuando creamos el ingrediente lo hacemos sensor 
		 * 
		 */		
		override protected function onReset():void{
			
			super.onReset();
			/*
			super.onReset();
			var shape:b2Shape = this.body.m_shapeList;
			
			while(shape!=null){
				shape.m_isSensor = true;
				shape = shape.m_next;
			}
			*/	
		}
	
	}
}